home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13749 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: ix.netcom.com!news
  2. From: David Brownell <brownell@ix.netcom.com>
  3. Newsgroups: comp.object,comp.lang.eiffel,comp.lang.c++,comp.lang.beta,comp.lang.java,comp.lang.sather
  4. Subject: Re: What Should An Exception Handling Do? -- Clarification of rules
  5. Date: Tue, 26 Mar 1996 16:20:33 -0800
  6. Organization: Dave's VAX
  7. Message-ID: <315889D1.3316@ix.netcom.com>
  8. References: <1996Mar14.155641.4299@schbbs.mot.com> <4irn11$7ln@mimas.brunel.ac.uk> <Pine.Sola.3.91.960322041345.17711C-100000@ux5.cso.uiuc.edu>
  9. NNTP-Posting-Host: pax-ca23-07.ix.netcom.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-NETCOM-Date: Tue Mar 26  6:28:21 PM CST 1996
  14. X-Mailer: Mozilla 2.0 (Win95; I)
  15. CC: brownell@ix.netcom.com
  16.  
  17. In the context of that "C++ done me wrong" flamage, someone had a
  18. good point that it's useful to be able to reclaim resources and
  19. automagically retry.
  20.  
  21. However, the "resumable exceptions" model seems to be less useful
  22. than a model that's already possible in C++ and most languages:
  23. call in those overdue books, taxes, etc. since you know who has them!
  24. Or even the model that's used in the C++ runtime:  set_new_handler()
  25. is a hook that lets applications free up memory when needed.  The same
  26. can be done on a per-class basis whenever needed.
  27.  
  28.  
  29. I missed the original posting ... but assuming the title is a good
  30. summary, I think C++ "catch" clauses should only be responsible
  31. for fault recovery or reporting.  The "clean up" aspects should be
  32. mapped to classes, like "smart pointers", that release memory and
  33. other resources as appropriate when they're destroyed as part of the
  34. stack unwinding that the exception initiated.
  35. -- 
  36. David Brownell <brownell@ix.netcom.com>
  37.     Enjoy the blossoms of Enlightenment in their season
  38.     and harvest the fruit of the right path.
  39.